package club.baimahu.pencil.servlet.controller;


import com.alibaba.fastjson.JSONObject;
import club.baimahu.pencil.servlet.annotation.Controller;
import club.baimahu.pencil.servlet.annotation.RequestBody;
import club.baimahu.pencil.servlet.annotation.RequestMapping;
import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Controller
public class SimpleController {

    public SimpleController(){}

    Logger logger = LoggerFactory.getLogger(SimpleController.class);


    @RequestMapping("hello")
    public User hello(@RequestBody User user, User user2){
        logger.info("user is {}", JSONObject.toJSONString(user));
        logger.info("user2 is {}", JSONObject.toJSONString(user2));
        return user;
    }


    @Data
    public static class User{
        private String userName;
        private int age;
        public User(String userName,int age){
            this.userName = userName;
            this.age = age;
        }

        public User(){}

        public String getUserName() {
            return userName;
        }

        public void setUserName(String userName) {
            this.userName = userName;
        }

        public int getAge() {
            return age;
        }

        public void setAge(int age) {
            this.age = age;
        }
    }



}
